<?php
require('../../../wp-config.php');
$plugin_url = trailingslashit( WP_PLUGIN_URL.'/'. dirname( plugin_basename(__FILE__)));
global $wpdb;
?>
<div id="loading" align="center" style="display:none;"><img src="<?php echo $plugin_url;?>images/loading.gif" /><br />Loading...</div>
<input type="hidden" id="name" />
<input type="hidden" id="id" />
<?php $stt = 1;foreach($wpdb->get_results("SELECT * FROM wp_category") as $category): ?>
<div style="background-color:#CCCCCC;color:white;font-weight: bold;margin-top:10px;"><a href="javascript:void(0);" onclick="property_display('<?php echo $category->id;?>','<?php echo $category->name;?>');" style="color:#FFFFFF;"><?php echo $category->name;?></a></div>
<br />
<?php foreach($wpdb->get_results("SELECT * FROM wp_attribute WHERE category=".$category->id) as $row){echo '<a href="javascript:void(0);" onclick="attribute_display('.$row->id.',\''.$row->name.'\','.$category->id.');" >'.$row->name.'</a>&nbsp;';}?>
...<a class="button add-new-h2" href="javascript:void(0);" onclick="add_attribute(<?php echo $category->id;?>);">Add New</a>
<p></p>
<div id="edit_<?php echo $category->id;?>" align="center" style="display:none;"><a class="button add-new-h2" href="javascript:void" onclick="edit_attribute();">Edit</a><a class="button add-new-h2"  href="javascript:void" onclick="delete_attribute();">Delete</a></div>
<p></p>
<div id="property_<?php echo $category->id;?>" align="center" style="display:none;"><a class="button add-new-h2" href="javascript:void" onclick="edit_property();">Edit property</a><a class="button add-new-h2"  href="javascript:void" onclick="delete_property();">Delete property</a></div>
<?php $stt++; endforeach;?>
<input type="hidden" id="count" value="<?php echo $stt;?>" />
<input type="hidden" id="property_name" value="" />
<input type="hidden" id="property_id" value="" />
<hr />
<br />
<center><a class="button add-new-h2" href="javascript:void(0);" onclick="add_property();">Add New Property</a></center>
